﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace HelixSoftware.Azure.Common
{
    public class ServiceLocator
    {
        #region Properties

        private IDictionary<Type, object> _Items;

        #endregion

        #region Constructors

        public ServiceLocator()
        {
            _Items = new Dictionary<Type, object>();
        }

        #endregion

        #region Methods

        public void RegisterService<T>(T service)
        {
            _Items.Add(typeof(T), service);
        }

        public T GetService<T>()
        {
            return (T)_Items[typeof(T)];
        }

        #endregion
    }
}
